/*	Copyright 2007 - Xavier Baro (xbaro@cvc.uab.cat)

	This file is part of eapmlib.

    Eapmlib is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or any 
	later version.

    Eapmlib is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __FEATURE_H__
#define __FEATURE_H__

#include "EvolutiveLib.h"
#include "Data.h"
#include "Chromosome.h"
//#include "cv.h"
#include <fstream>
#include <iostream>

namespace Evolutive {

	class EVOLUTIVELIB_API CFeature
	{
		//! Methods
	public:
		//! Default constructor		
		CFeature(void);

		//! Default destructor
		virtual ~CFeature(void);

		//! Returns the class name
		virtual string GetClassNameID(void) = 0;

		//! Sets the feature parameters
		void SetParameters(CChromosome *C);
		virtual void SetParameters(int NumParameters, double *Parameters) = 0;

		//! Apply the feature to an image object
		virtual double Apply(CData *InputData) = 0;

		//! Verify if a feature is a valid feature
		virtual bool IsValid(CvSize WinSize,bool UseColor) = 0;

		//! Obtain the number of parameters that defines the feature
		virtual int GetNumParameters(void) = 0;

		//! Obtain a pointer to the parameters		
		virtual void GetParameters(double *Parameters) = 0;

		//! Save or recover the data to/from a file
		virtual void Serialize(std::fstream &fs,bool Saving);
								
	protected:
					
		//! Attributes
	protected:		
				
	};	
}

#endif // __FEATURE_H__
